{extend name="Public:base"/}

{block name="main"}
<div class="box-info">
    <form method="post" action="{:U('Block/edit')}">
        <div class="form-group row">
            <label class="form-control-label col-md-2">名称:</label>
            <div class="col-md-8">
                <input type="text" class="form-control" name="name" id="name" value="{$vo.name}" {if condition="$Think.session.adminid neq 1"}disabled{/if}>
            </div>
        </div>
        {eq name="Think.const.APP_ENV" value="dev"}
        <div class="form-group row">
            <label class="form-control-label col-md-2">碎片类型:</label>
            <div class="col-md-8">
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" type="radio" name="type" {eq name="vo.type" value="url"}checked{/eq} value="url">链接地址
                    </label>
                </div>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" type="radio" name="type" {eq name="vo.type" value="img"}checked{/eq} value="img">图片
                    </label>
                </div>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" type="radio" name="type" {eq name="vo.type" value="file"}checked{/eq} value="file">文件
                    </label>
                </div>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" type="radio" name="type" {eq name="vo.type" value="text"}checked{/eq} value="text">纯文本
                    </label>
                </div>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" type="radio" name="type" {eq name="vo.type" value="rtf"}checked{/eq} value="rtf">富文本
                    </label>
                </div>

            </div>
        </div>
        {/eq}
        <div class="form-group row">
            <label class="form-control-label col-md-2">内容:</label>
            <div class="col-md-8">
                {if condition="$vo['type'] == 'url'"}
                <input type="text" class="form-control" name="content" value="{$vo.content}">
                {elseif condition="$vo['type'] == 'img'"/}
                <input type="hidden" id="content" name="content"  value="{$vo['content']}" size="40" />
                <div class="card w-300px">
                    <div id="image_aid_box"></div>
                    <a class="thumbnail" href="javascript:swfupload('content','{:get_auth(1,'1048576',1)}',yesdo)">
                        <img class="card-img" src="{if condition="!empty($vo['content'])"}{$vo['content']}{else/}__IMG__/upload_thumb.png{/if}" id="content_pic">
                    </a>
                    <input type="button" value="取消图片" onclick="javascript:clean_thumb('content');" class="btn btn-sm btn-info" style="margin:0;" />
                </div>
                {elseif condition="$vo['type'] == 'file'"/}
                <div class="input-group">
                    <div id="file_aid_box"></div>
                    <input type="text" class="form-control w-300" name="content" id="content" value="{$vo['content']}">
                    <span class="input-group-addon" onclick="javascript:swfupload('content','{:get_auth(1,'5MB',1,'zip,rar,doc,docx,pdf,excel')}',yesdo)">文件上传</span>
                </div>
                {elseif condition="$vo['type'] == 'text'"/}
                <textarea name="content" class="form-control" cols="30" rows="10">{$vo.content}</textarea>
                {else/}
                <script type="text/javascript" charset="utf-8" src="/public/static/neditor/neditor.config.js"></script>
                <script type="text/javascript" charset="utf-8" src="/public/static/neditor/neditor.all.min.js"> </script>
                <script type="text/javascript" charset="utf-8" src="/public/static/neditor/lang/zh-cn/zh-cn.js"></script>
                {: $form->editor(array('field'=>'content','moduleid'=>'231','setup'=>array('toolbar'=>'full','flashupload'=>'1')),$vo[content])}
                {/if}
            </div>
        </div>
        <div class="form-actions">
            <input type="hidden" name="id" value="{$vo.id}">
            <button type="submit" class="btn btn-primary ajax_form_edit">提交</button>
            <button type="button" class="btn btn-danger" onclick="javascript:history.back(-1);return false;">返回</button>
        </div>
    </form>
</div>

{/block}